import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('@renderer/views/home.vue'),
    redirect: { name: 'logList' },
    children: [
      {
        path: 'logList',
        name: 'logList',
        component: () => import('@renderer/views/logList/dateList.vue')
        // redirect: { name: 'log', params: { id: 1 } },
        // children: [
        //   {
        //     path: 'log/:id',
        //     name: 'log',
        //     component: () => import('@renderer/views/log/index.vue')
        //   },
        //   {
        //     path: 'record/:id',
        //     name: 'record',
        //     component: () => import('@renderer/views/record/index.vue')
        //   }
        // ]
      },
      {
        path: 'log/:id',
        name: 'log',
        component: () => import('@renderer/views/log/index.vue')
      },
      {
        path: 'record/:id',
        name: 'record',
        component: () => import('@renderer/views/record/index.vue')
      },
      {
        path: 'projList',
        name: 'projList',
        component: () => import('@renderer/views/projList/index.vue'),
        redirect: { name: 'proj', params: { id: 1 } },
        children: [
          {
            path: 'proj/:id',
            name: 'proj',
            component: () => import('@renderer/views/proj/index.vue')
          }
        ]
      },
      {
        path: 'teamList',
        name: 'teamList',
        component: () => import('@renderer/views/teamList/index.vue')
      },
      {
        path: 'subpackage',
        name: 'subpackage',
        component: () => import('@renderer/views/subpackage/index.vue')
      },
      {
        path: 'weekly',
        name: 'weekly',
        component: () => import('@renderer/views/weekly/index.vue')
      },
      {
        path: 'team/:id',
        name: 'team',
        component: () => import('@renderer/views/team/index.vue')
      },
      {
        path: 'config',
        name: 'config',
        component: () => import('@renderer/views/config/index.vue')
      }
    ]
  },
  {
    path: '/code',
    name: 'code',
    component: () => import('@renderer/views/code/index.vue')
  }
] as RouteRecordRaw[]

export const router = createRouter({
  history: createWebHistory(),
  routes
})
